<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>index</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="__STATIC__/xadmin/css/font.css">
    <link rel="stylesheet" href="__STATIC__/xadmin/css/xadmin.css">
    <script src="__STATIC__/xadmin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__STATIC__/xadmin/js/xadmin.js"></script>
</head>

<body>
    <div class="x-nav">
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
        </a>
    </div>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5" method="get" action="{:url('account/index')}">
                            <div class="layui-input-inline layui-show-xs-block">
                                <input class="layui-input" placeholder="开户日起" value="{$start}" name="start" id="start">
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <input class="layui-input" placeholder="开户日止" value="{$end}" name="end" id="end">
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <input type="text" value="{$name}" name="name" placeholder="请输入账号名称" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <input type="text" value="{$a_id}" name="a_id" placeholder="请输入账号ID" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <select name="type">
                                    <option value="">请选择类型</option>
                                    <option value="1" {if condition="$type eq 1"}selected{/if}>搜索</option>
                                    <option value="2" {if condition="$type eq 2"}selected{/if}>信息流</option>
                                </select>
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <select name="ader">
                                    <option value="">请选择广告商</option>
                                    {volist name="adlist" id="vo"}
                                    <option value="{$vo.id}" {if condition="$vo.id eq $ader"}selected{/if}>{$vo.ader}</option>
                                    {/volist}
                                </select>
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <select name="agent">
                                    <option value="">请选择代理商</option>
                                    {volist name="aglist" id="vo"}
                                    <option value="{$vo.id}" {if condition="$vo.id eq $agent"}selected{/if}>{$vo.name}</option>
                                    {/volist}
                                </select>
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <select name="m_id">
                                    <option value="">请选择优化师</option>
                                    {volist name="memlist" id="vo"}
                                    <option value="{$vo.uid}" {if condition="$vo.uid eq $m_id"}selected{/if}>{$vo.username}</option>
                                    {/volist}
                                </select>
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                    <i class="layui-icon">&#xe615;</i></button>
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <a class="layui-btn" href="javascript:;" onclick="xadmin.open('添加','{:url('account/addExcel');}',500,500)">
                                    <i class="layui-icon">&#xe62c;</i>导入表格
                                </a>
                            </div>
                        </form>

                    </div>
                    <div class="layui-card-header">
                        <button class="layui-btn" onclick="xadmin.open('添加','{:url('account/add');}',500,500)"><i class="layui-icon"></i>添加</button>
                    </div>
                    <div class="layui-card-body ">
                        <table class="layui-table layui-form">
                            <thead>
                                <tr>
                                    <th width="30">ID</th>
                                    <th>账号名称</th>
                                    <th>账号ID</th>
                                    <th>类型</th>
                                    <th>广告商</th>
                                    <th>代理商</th>
                                    <th>项目</th>
                                    <th>代理商返点</th>
                                    <th>优化师</th>
                                    <th>状态</th>
                                    <th>开户日期</th>
                                    <th>添加时间</th>
                                    <th>报表</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                {volist name="list" id="vo"}
                                <tr>
                                    <td>{$vo.id}</td>
                                    <td>{$vo.name}</td>
                                    <td>{$vo.a_id}</td>
                                    <td>{if condition="$vo.push_type eq 1"}搜索{elseif condition="$vo.push_type eq 2"}信息流{/if}</td>
                                    <td>{$vo.ader_id|get_ader_name}</td>
                                    <td>{$vo.agent_id|get_agent_name}</td>
                                    <td>{$vo.id|get_accpro_name}</td>
                                    <td>{$vo.rebate}%</td>
                                    <td>{$vo.m_id|get_member}</td>
                                    <td>{if condition="$vo.status eq 1"}正常{elseif condition="$vo.status eq 2"}禁用{/if}</td>
                                    <td>{$vo.open_time|date="Y-m-d",###}</td>
                                    <td>{$vo.add_time|date="Y-m-d H:i:s",###}</td>
                                    <td>
                                        <a  href="{:url('excelList',array('a_id'=>$vo.id))}">查看表格</a>
                                        <a onclick="xadmin.open('报表日历','{:url('looksExcel',array('a_id'=>$vo.id))}',800,680)" href="javascript:;">报表日历</a>
                                    </td>
                                    <td>
                                        <a title="修改" onclick="xadmin.open('修改','{:url('account/edit',['id'=>$vo['id']])}',500,500)"><i class="layui-icon">&#xe642;</i></a>
                                        <!--<a title="删除" onclick="del(this,'{$vo.id}','{$vo.name}')" href="javascript:;"><i class="layui-icon">&#xe640;</i></a>-->
                                    </td>
                                </tr>
                                {/volist}
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                           {$list->render()}<p style="padding:10px;display:inline-block;">共&nbsp;&nbsp;{$list->total()}&nbsp;条</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });
            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
    });
    //删除
    function del(obj,id,name){
        layer.confirm('确认要删除'+name+'吗？',function(index){
            $.ajax({
                type: "post",
                url: "{:url('account/del')}",
                data: {id:id},
                success: function(data){
                    if(data.status == 1){
                        layer.msg('删除成功!',{icon:1,time:1000});
                        setTimeout(function(){
                            location.href="{:url('account/index')}";
                        },1000);
                    }else{
                        layer.msg('删除失败!',{icon:2,time:1000});
                    }
                }
            });
            return false;
        });
    }

</script>
</html>